{{#d-section pageClass="user-summary"}}
  <div class='top-section stats-section'>
    <h3 class='stats-title'>{{i18n "user.summary.stats"}}</h3>
    <ul>
      <li>
        {{user-stat value=model.days_visited label="user.summary.days_visited"}}
      </li>
      <li>
        <span class='value'>{{model.time_read}}</span>
        <span class='label'>{{{i18n "user.summary.time_read"}}}</span>
      </li>
      <li>
        {{user-stat value=model.posts_read_count label="user.summary.posts_read"}}
      </li>
      <li class="linked-stat">
        {{#link-to 'userActivity.likesGiven'}}
          {{user-stat value=model.likes_given label="user.summary.likes_given"}}
        {{/link-to}}
      </li>
      {{#if model.bookmark_count}}
        <li class="linked-stat">
          {{#link-to 'userActivity.bookmarks'}}
            {{user-stat value=model.bookmark_count label="user.summary.bookmark_count"}}
          {{/link-to}}
        </li>
      {{/if}}
      <li class="linked-stat">
        {{#link-to 'userActivity.topics'}}
          {{user-stat value=model.topic_count label="user.summary.topic_count"}}
        {{/link-to}}
      </li>
      <li class="linked-stat">
        {{#link-to 'userActivity.replies'}}
          {{user-stat value=model.post_count label="user.summary.post_count"}}
        {{/link-to}}
      </li>
      <li>
          {{user-stat value=model.likes_received label="user.summary.likes_received"}}
      </li>
      {{plugin-outlet name="user-summary-stat"
                      connectorTagName="li"
                      args=(hash model=model)}}
    </ul>
  </div>

  <div class='top-section'>
    <div class='top-sub-section replies-section pull-left'>
      <h3 class='stats-title'>{{i18n "user.summary.top_replies"}}</h3>
      {{#if model.replies.length}}
        <ul>
          {{#each model.replies as |reply|}}
            <li>
              <span class='topic-info'>
                {{format-date reply.createdAt format="tiny" noTitle="true"}}
                {{#if reply.like_count}}
                  &middot;
                  {{fa-icon 'heart'}}&nbsp;<span class='like-count'>{{number reply.like_count}}</span>
                {{/if}}
              </span>
              <br>
              <a href="{{unbound reply.url}}">{{{reply.topic.fancyTitle}}}</a>
            </li>
          {{/each}}
        </ul>
        {{#if moreReplies}}
          <p>{{#link-to "userActivity.replies" user class="more"}}{{i18n "user.summary.more_replies"}}{{/link-to}}</p>
        {{/if}}
      {{else}}
        <p>{{i18n "user.summary.no_replies"}}</p>
      {{/if}}
    </div>
    <div class='top-sub-section topics-section pull-right'>
      <h3 class='stats-title'>{{i18n "user.summary.top_topics"}}</h3>
      {{#if model.topics.length}}
        <ul>
          {{#each model.topics as |topic|}}
            <li>
              <span class='topic-info'>
                {{format-date topic.createdAt format="tiny" noTitle="true"}}
                {{#if topic.like_count}}
                  &middot;
                  {{fa-icon 'heart'}}&nbsp;<span class='like-count'>{{number topic.like_count}}</span>
                {{/if}}
              </span>
              <br>
              <a href="{{unbound topic.url}}">{{{topic.fancyTitle}}}</a>
            </li>
          {{/each}}
        </ul>
        {{#if moreTopics}}
          <p>{{#link-to "userActivity.topics" user class="more"}}{{i18n "user.summary.more_topics"}}{{/link-to}}</p>
        {{/if}}
      {{else}}
        <p>{{i18n "user.summary.no_topics"}}</p>
      {{/if}}
    </div>
  </div>

  <div class='top-section'>
    <div class='top-sub-section links-section pull-left'>
      <h3 class='stats-title'>{{i18n "user.summary.top_links"}}</h3>
      {{#if model.links.length}}
        <ul>
          {{#each model.links as |link|}}
            <li>
              <a class='domain'
                 href='{{unbound link.url}}'
                 title='{{unbound link.title}}'
                 rel='{{unless user.removeNoFollow 'nofollow noopener'}}'
                 target='_blank'>
                {{shorten-url link.url}}
              </a>
              <span class='badge badge-notification clicks' title='{{i18n 'topic_map.clicks' count=link.clicks}}'>{{number link.clicks}}</span>
              <br>
              <a href="{{unbound link.post_url}}">{{{link.topic.fancyTitle}}}</a>
            </li>
          {{/each}}
        </ul>
      {{else}}
        <p>{{i18n "user.summary.no_links"}}</p>
      {{/if}}
    </div>
    <div class='top-sub-section likes-section pull-right'>
    <h3 class='stats-title'>{{i18n "user.summary.most_replied_to_users"}}</h3>
      {{#if model.most_replied_to_users.length}}
        <ul>
          {{#each model.most_replied_to_users as |user|}}
            <li>
              {{#user-info user=user}}
                {{fa-icon "reply"}}
                <span class='replies'>{{number user.count}}</span>
              {{/user-info}}
            </li>
          {{/each}}
        </ul>
      {{else}}
        <p>{{i18n "user.summary.no_replies"}}</p>
      {{/if}}
    </div>
  </div>

  <div class='top-section'>
    <div class='top-sub-section likes-section pull-left'>
      <h3 class='stats-title'>{{i18n "user.summary.most_liked_by"}}</h3>
      {{#if model.most_liked_by_users.length}}
        <ul>
          {{#each model.most_liked_by_users as |user|}}
            <li>
              {{#user-info user=user}}
                {{fa-icon "heart"}}
                <span class='likes'>{{number user.count}}</span>
              {{/user-info}}
            </li>
          {{/each}}
        </ul>
      {{else}}
        <p>{{i18n "user.summary.no_likes"}}</p>
      {{/if}}
    </div>
    <div class='top-sub-section likes-section pull-right'>
      <h3 class='stats-title'>{{i18n "user.summary.most_liked_users"}}</h3>
      {{#if model.most_liked_users.length}}
        <ul>
          {{#each model.most_liked_users as |user|}}
            <li>
              {{#user-info user=user}}
                {{fa-icon "heart"}}
                <span class='likes'>{{number user.count}}</span>
              {{/user-info}}
            </li>
          {{/each}}
        </ul>
      {{else}}
        <p>{{i18n "user.summary.no_likes"}}</p>
      {{/if}}
    </div>
  </div>

  <div class='top-section badges-section'>
    <h3 class='stats-title'>{{i18n "user.summary.top_badges"}}</h3>
    {{#each model.badges as |badge|}}
      {{badge-card badge=badge count=badge.count navigateOnClick="true" username=user.username_lower}}
    {{else}}
      <p>{{i18n "user.summary.no_badges"}}</p>
    {{/each}}
    {{#if moreBadges}}
      <p>{{#link-to "user.badges" user class="more"}}{{i18n "user.summary.more_badges"}}{{/link-to}}</p>
    {{/if}}
  </div>
{{/d-section}}
